<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../../taglib.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<easyui:list>
<html>
<head>
<base href="<%=basePath%>" />
<title></title>
<%@ include file="/webmodules/console/css.jsp"%>
<%@ include file="/webmodules/console/js.jsp"%>
<script type="text/javascript">
${js}
function stop(){
	var rows = $('#mydatagrid').datagrid('getSelections');
	if (rows.length > 0){
		var ids = new Array();
		for ( var i = 0; i < rows.length; i++) {
			ids.push(rows[i].ID);
		}
		$.post("dragon/modules/system/user/action/UserHandler/sors.ejw",{ids:ids.join(","),state:0},function(data) { 
				if(data.result !=undefined && data.result == true){
					$('#mydatagrid').datagrid('reload');
					top.showMsg("", "停用成功！", false);
				}
				if(data.MESSAGE_ERROR != undefined && data.MESSAGE_ERROR != ''){
					top.showMsg("错误", data.MESSAGE_ERROR, true,'error');
				}else if(data.MESSAGE_WARNING != undefined && data.MESSAGE_WARNING != ''){
					top.showMsg("警告", data.MESSAGE_WARNING, true,'warning');
				}else if(data.MESSAGE_INFO != undefined && data.MESSAGE_INFO != ''){
					top.showMsg("", data.MESSAGE_INFO, false);
				}
	 		},'json'); 
		}else{
			top.showMsg("", "请选择要操作的数据！", true);
		}
}
function start(){
	var rows = $('#mydatagrid').datagrid('getSelections');
	if (rows.length > 0){
		var ids = new Array();
		for ( var i = 0; i < rows.length; i++) {
			ids.push(rows[i].ID);
		}
		$.post("dragon/modules/system/user/action/UserHandler/sors.ejw",{ids:ids.join(","),state:1},function(data) { 
				if(data.result !=undefined && data.result == true){
					$('#mydatagrid').datagrid('reload');
					top.showMsg("", "启用成功！", false);
				}
				if(data.MESSAGE_ERROR != undefined && data.MESSAGE_ERROR != ''){
					top.showMsg("错误", data.MESSAGE_ERROR, true,'error');
				}else if(data.MESSAGE_WARNING != undefined && data.MESSAGE_WARNING != ''){
					top.showMsg("警告", data.MESSAGE_WARNING, true,'warning');
				}else if(data.MESSAGE_INFO != undefined && data.MESSAGE_INFO != ''){
					top.showMsg("", data.MESSAGE_INFO, false);
				}
	 		},'json'); 
		}else{
			top.showMsg("", "请选择要操作的数据！", true);
		}
}
function remove(){
	if(!($("#ORG").val()=="0"||$("#ORG").val()=="null"||$("#ORG").val()=="")){
		var rows = $('#mydatagrid').datagrid('getSelections');
		if (rows.length > 0) {
			top.showConfirm("移除确认","移除删除？",function(){
				var ids = new Array();
				for ( var i = 0; i < rows.length; i++) {
					ids.push(rows[i].ID);
				}
				$.post("dragon/modules/system/user/action/UserHandler/remove.ejw", {
					ids : ids.join(",")
				}, function(data) {
					if (data == "t") {
						for ( var i = 0; i < rows.length; i++) {
							var index = $('#mydatagrid').datagrid('getRowIndex', rows[i]);
							$('#mydatagrid').datagrid('deleteRow', index);
						}
						rows = null;
						top.showMsg("", "移除成功！", false);
					} else {
						top.showErrorMsg("出错了", data);
					}
				});
				ids = null;
			},null);
		} else {
			top.showMsg("", "请先选择数据！", true);
		}
	}
}
function fpyh(){
	if($("#ORG").val()=="0"||$("#ORG").val()=="null"||$("#ORG").val()==""){
		top.showMsg("", "请先在左侧选择要分配到的组织机构！", true);
	 }else{
		 top.showWindow(null, "分配新用户给当前部门", "webmodules/system/user/addUserToOrg.jsp?bizcode=${bizObject.code}", 600, 300); 
	}
}
function bgbm(){
	var rows = $('#mydatagrid').datagrid('getSelections');
	if (rows.length == 1) {
		top.showWindow(null, "更改用户《"+rows[0].USERNAME+"》的部门", "webmodules/system/user/changeUserOrg.jsp?bizcode=${bizObject.code}", 600, 300);
	}else{
		top.showMsg("", "请选择一行数据！", true);
	}
}
function jsgl(){
	var rows = $('#mydatagrid').datagrid('getSelections');
	if (rows.length == 1) {
		top.showWindow(null, "管理用户《"+rows[0].USERNAME+"》的角色", "webmodules/system/user/modUserRoles.jsp?bizcode=${bizObject.code}&uid="+rows[0].ID, 580, 355);
	}else{
		top.showMsg("", "请选择一行数据！", true);
	}	
}
function kczjs(){
	var rows = $('#mydatagrid').datagrid('getSelections');
	if (rows.length == 1) {
		top.showWindow(null, "配置用户《"+rows[0].USERNAME+"》可管理的角色", "webmodules/system/user/modUserManagementRoles.jsp?bizcode=${bizObject.code}&uid="+rows[0].ID, 580, 355);
	}else{
		top.showMsg("", "请选择一行数据！", true);
	}	
}
function hasmenu(){
	var rows = $('#mydatagrid').datagrid('getSelections');
	if (rows.length == 1) {
		top.showWindow(null, "查看用户《"+rows[0].USERNAME+"》的已授权菜单", "webmodules/system/user/userMenuView.jsp?uid="+rows[0].ID, 400, 500);
	}else{
		top.showMsg("", "请选择一行数据！", true);
	}	
}
</script>
</head>
<body>
${html}
</body>
</html>
</easyui:list>
